<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:if test="${billType=='BUY'}">
	<c:set var="billTypeName" value="采购" />
</c:if>
<c:if test="${billType=='BACK'}">
	<c:set var="billTypeName" value="退货" />
</c:if>
<c:set var="pageTitle" value="${billTypeName}单关联单据" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doShow(id,type){
		var url;
		if(type=="pay"){
			url="/finance/PayBillInfoForCancel.ihtm?id="+id;
		}else if(type=="adjust"){
			url="/finance/AdjustBillInfoForCancel.ihtm?id="+id;
		}else{
			return;
		}
		ShowIframe("查看",url,900,500,"refreshWin()",900,600);
	}
	function refreshWin(){
		if(popRetVal!=null){
			window.location=window.location;
		}
	}
	function doCancel(id,type){
		var url="/system/CancelReasonNew.ihtm?id="+id+"&cancel_type="+type;
		ShowIframe("作废",url,900,300,"refreshWin()",900,600);
	}
</script>
</head>
<body oncontextmenu="return false" class="sheet" style="text-align:center;">
<div class="sheet-main" style="width:860px;text-align:left;margin:auto;">
  <div class="sheet-top">
    <div class="content">
      <h2>作废关联单据</h2>
      <p>${billTypeName}单${code}没有发生后续单据才能够进行作废</p>
    </div>
  </div>
  <%@include file="../inc/AlertMsg.jsp"%>
  <div class="sheet-list">
    <div class="search-business">
     <div class="table-list">
        <table width="100%">
           	<tr>
			   	<th  width="20%">付款单号</th>
				<th  width="14%">日期</th>
				<th  width="34%">摘要</th>
				<th  width="10%">开单人</th>
				<th  width="10%">状态</th>
				<th  width="12%">操作</th>
			</tr>
			<c:if test="${fn:length(payList)==0}">
			<tr>
				<td colspan="6">没有付款单</td>
			</tr>
			</c:if>
			<c:if test="${fn:length(payList)>0}">
			<c:forEach var="item" items="${payList}" varStatus="i">
				<tr>
					<td >${item.billCode}</td>
					<td ><fmt:formatDate value="${item.payDate}" pattern="yyyy-MM-dd"/></td>
					<td >${item.description}</td>
					<td >${item.createrName}</td>
					<td >
						<c:if test="${item.examined=='N'}">未审核</c:if>
						<c:if test="${item.examined=='Y'}">已审核</c:if>
					</td>
					<td>
						<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';PAY_CANC;')!=-1}">
						<a href="javascript:doCancel('${item.id}','pay');">作废</a>
						<a href="javascript:doShow('${item.id}','pay');">查看</a>
						</c:if>
					</td>
				</tr>
			</c:forEach>
			</c:if>
		</table>
     </div>
     <div class="blank12"></div>
     
     <div class="table-list">
        <table width="100%">
           	<tr>
			   	<th  width="20%">调账单号</th>
				<th  width="14%">日期</th>
				<th  width="34%">摘要</th>
				<th  width="10%">开单人</th>
				<th  width="10%">状态</th>
				<th  width="12%">操作</th>
			</tr>
			<c:if test="${fn:length(adjustList)==0}">
			<tr>
				<td colspan="6">没有调账单</td>
			</tr>
			</c:if>
			<c:if test="${fn:length(adjustList)>0}">
			<c:forEach var="item" items="${adjustList}" varStatus="i">
				<tr>
					<td >${item.billCode}</td>
					<td ><fmt:formatDate value="${item.adjustDate}" pattern="yyyy-MM-dd"/></td>
					<td >${item.description}</td>
					<td >${item.createrName}</td>
					<td >
						<c:if test="${item.examined=='N'}">未审核</c:if>
						<c:if test="${item.examined=='Y'}">已审核</c:if>
					</td>
					<td>
						<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';ADJU_CANC;')!=-1}">
						<a href="javascript:doCancel('${item.id}','adjust');">作废</a>
						<a href="javascript:doShow('${item.id}','adjust');">查看</a>
						</c:if>
					</td>
				</tr>
			</c:forEach>
			</c:if>
		</table>
     </div>
    </div>
  </div>
</div>	
</body>
</html>